/*
 * Zhz.net Inc.
 * Copyright (c) 2010 All Rights Reserved.
 */
package com.zhz.lib.project.ibatis.dao.bookreview.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.zhz.lib.project.ibatis.dao.bookreview.BookreviewDAO;
import com.zhz.lib.project.ibatis.domain.bookreview.Bookreview;

/**
 * An ibatis based implementation of dao interface <tt>com.zhz.project.dal.daointerface.BookreviewDAO</tt>.
 *
 * This file is generated by <tt>paygw-dalgen</tt>, a DAL (Data Access Layer)
 * code generation utility specially developed for <tt>paygw</tt> project.
 * 
 * PLEASE DO NOT MODIFY THIS FILE MANUALLY, or else your modification may
 * be OVERWRITTEN by someone else. To modify the file, you should go to 
 * directory <tt>(project-home)/biz/dal/src/conf/dalgen</tt>, and 
 * find the corresponding configuration file (<tt>tables/bookreview.xml</tt>). 
 * Modify the configuration file according to your needs, then run <tt>paygw-dalgen</tt> 
 * to generate this file.
 *
 * @author Li Wei
 */
public class IbatisBookreviewDAO extends SqlMapClientDaoSupport implements BookreviewDAO {
    /**
     *  Query DB table <tt>bookreview</tt> for records.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>select * from bookreview where (id = ?)</tt>
     *
     *	@param id
     *	@return BookreviewDO
     *	@throws DataAccessException
     */
    public Bookreview getById(long id) throws DataAccessException {

        return (Bookreview) getSqlMapClientTemplate().queryForObject("MS-BOOKREVIEW-GET-BY-ID", id);

    }

    /**
     *  Query DB table <tt>bookreview</tt> for records.
     *
     *  <p>
     *  Description for this operation is<br>
     *  <tt></tt>
     *  <p>
     *  The sql statement for this operation is <br>
     *  <tt>select * from bookreview</tt>
     *
     *	@return List<BookreviewDO>
     *	@throws DataAccessException
     */
    public List<Bookreview> getAllBookreview() throws DataAccessException {

        return getSqlMapClientTemplate().queryForList("MS-BOOKREVIEW-GET-ALL-BOOKREVIEW", null);

    }

    public void bookreviewHitPlusOne(String id) {
        Map map = new HashMap<String, Integer>();
        map.put("bookreviewId", id);
        getSqlMapClientTemplate().update("bookreviewHitPlusOne", map);
    }

}